This page last changed on Dec 13, 2004 by casey.

Webwork能为活动定义一个缺省结果类型. 因此, 你不必指定结果类型. 如果一个包扩展了另一个包而没有为子包指定新的缺省结果类型, 当result元素的type属性未指定时也将使用父包的缺省结果类型.

<!-- parts of xwork.xml  -->
....

<result-types>
 <result-type name="dispatcher" class="com.opensymphony.webwork.dispatcher.ServletDispatcherResult" default="true"/>
 <result-type name="redirect" class="com.opensymphony.webwork.dispatcher.ServletRedirectResult"/>
 <result-type name="velocity" class="com.opensymphony.webwork.dispatcher.VelocityResult"/>
</result-types>

....

<action name="bar" class="myPackage.barAction">

<!-- this result uses dispatcher, so you can omit the type="dispatcher" if you want -->
  <result name="success">foo.jsp</result>

<!-- this result uses velocity result, so the type needs to be specified -->
  <result name="error" type="velocity">error.vm</result>

</action>

....
Document generated by Confluence on Dec 14, 2004 16:36